<template>
  <div>
    <h3>管理员信息</h3>
    <p>管理员ID：{{ id }}</p>
    <p>账号:{{ username }}</p>
    <p>用户组：{{ usergroup }}</p>
    <p>创建时间：{{ date }}</p>
    <p>管理员头像：<img :src="img" alt="" /></p>
  </div>
</template>

<script>
import { getcuruserinfo } from "@/apis/users";
export default {
  data() {
    return {
      id: "",
      username: "",
      usergroup: "",
      date: "",
      img: "",
    };
  },
  created() {
    getcuruserinfo({
      id: JSON.parse(window.localStorage.getItem("userid")),
    }).then((res) => {
      let newdate = new Date(res.data.accountInfo.ctime);
      let newimgurl = res.data.accountInfo.imgUrl.replace(
        "127.0.0.1",
        "59.110.235.240"
      );
      this.id = res.data.accountInfo.id;
      this.username = res.data.accountInfo.account;
      this.usergroup = res.data.accountInfo.userGroup;
      this.date =
        newdate.getFullYear() +
        "/" +
        (newdate.getMonth() + 1) +
        "/" +
        newdate.getDate();
      this.img = newimgurl;
    });
  },
};
</script>

<style lang="less" scoped>
h3 {
  padding: 20px;
}
p {
  border-top: 2px solid #dddfe7;
  padding: 20px;
  display: flex;
  align-items: center;
  font-size: 20px;
  img {
    width: 200px;
    height: 200px;
  }
}
</style>